import $ from 'jQuery';
(function () {
  let $vue = null;
  $vue = new Vue({
    el: '.param_update-hook',
    data: {
      account: {
        'email': '',
        'gender': 1,
        'mobile': '',
        'userName': ''
      }
    },
    methods: {
      goBack: function () {
        M.Page.emitPrePage();
      },
      shieldchoose: function (){
        layer.open({
          type: 1,
          title: '内部参数设置',
          shadeClose: true,//是否点击遮罩关闭
          resize: false,//是否允许拉伸
          move: false,//禁止拖拽
          shade: 0.4,
          area: '450px',
          skin: 'layui-layer-rim',
          content: $('#xuanze'),
          btn: ['确认', '取消'],
          success: function () {//层弹出后的成功回调方法

          },
          yes: function(index, layero){//确定按钮回调方法
            layer.close(index);
          }
        })
      },
      alarmchoose: function(){
        layer.open({
          type: 1,
          title: '内部参数设置',
          shadeClose: true,//是否点击遮罩关闭
          resize: false,//是否允许拉伸
          move: false,//禁止拖拽
          shade: 0.4,
          area: '450px',
          skin: 'layui-layer-rim',
          content: $('#xuanze'),
          btn: ['确认', '取消'],
          success: function () {//层弹出后的成功回调方法

          },
          yes: function (index, layero){//确定按钮回调方法
            layer.close(index);
          }
        })
      }
    },
    mounted: function () {
      this.$nextTick(() => {
        $('.create-form-hook').validate({
          debug: true,
          rules: {
            mobile: {
              required: true,
              phoneCN: true,
              minlength: 11,
              maxlength: 11
            },
            email: {
              email: true,
              required: true,
              minlength: 1,
              maxlength: 50
            },
            userName: {
              required: true,
              minlength: 1,
              maxlength: 10
            },
            password: {
              required: true,
              minlength: 8,
              checkPwd: true,
              maxlength: 20
            },
            confirmPassword: {
              required: true,
              equalTo: '#equalToPassowrd'
            }
          }
          /*submitHandler: function (form) {
            IOT.showOverlay('保存中，请稍等...');
            let params = $vue.$data.account;
            IOT.getServerData(URI.OPERATE.PROJECT.DETAIL.PARAM_DATA, params, function (ret) {
              IOT.hideOverlay();
              if (ret && ret.code === 200) {
                IOT.tips('保存成功！', 'success');
                M.Table.refresh.all();
                M.Page.emitPrePage();
              } else {
                IOT.tips(ret.msg || '操作失败，请重试！', 'error', 1000, null);
              }
            });
            return false;
          }*/
        });
      });
    }
  });
})();